package com.ctl.config;

import com.ctl.entity.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
public class LoginToken {
    @Autowired
    private RedisTemplate redisTemplate;
    public void runExeption(String token){
        if (token==null){
            throw new RuntimeException("用户尚未登录，请先登录!");
        }
        Admin admin = (Admin) redisTemplate.opsForValue().get(token);
        if (admin==null){
            throw new RuntimeException("用户信息已过期，请重新登录!");
        }
    }
}
